package graphique;

import ij.process.ImageProcessor;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JTextField;

import application.RegionMerge;

public class RegionMergingListener implements ActionListener {
	
	private JTextField stepWidthField = null;
	private JTextField stepHeightField = null;
	private JTextField stepAireField = null;
	
	
	public RegionMergingListener(JTextField stepWidthField,JTextField stepHeightField, JTextField stepAireField) {
		super();
		this.stepWidthField = stepWidthField;
		this.stepHeightField = stepHeightField;
		this.stepAireField = stepAireField;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		int stepWidth = Integer.parseInt(stepWidthField.getText());
		int stepHeight = Integer.parseInt(stepHeightField.getText());
		int stepAire = Integer.parseInt(stepAireField.getText());
		ImageProcessor result = RegionMerge.run(Principal.image,stepWidth,stepHeight,stepAire);
		Principal.actualiseImage(result);
	}



}
